@extends('layouts.app')

@section('content')
    <div class="content">
        <div class="header">
            <ul class="breadcrumb">
                <li><i class="fa fa-fw fa-cog"></i>行政办案</li>
                <li>综合案件查询</li>
            </ul>
        </div>
        <div class="main-content">
            <div class="btn-toolbar list-toolbar">
                <form class="form-inline  text-center center-block" style="margin-top:0px;" method="post">

                    <input type="hidden" name="_token" value="{{ csrf_token() }}">

                  <!--   <span class="btn-default" type="button">案件名称</span> -->
                    <input class="input-xlarge form-control mg_b5" placeholder="案件名称" type="text" name="name" value="@if($_POST){{$_POST['name']}}@endif">
                   <!--  <span class="btn-default" type="button">所属单位</span>
 -->
                    <select class="input-xlarge form-control mg_b5" name="case_address">
                        <option value="">请选择所属单位</option>
                        @foreach ($units as $key=>$units)

                            
        
                                <option value="{{ $units->id }}">{{ $units->name }}</option>
                          

                        @endforeach

                    </select>

                    <!--  <span class="btn-default" type="button">是否结案</span> -->
                    <select class="input-xlarge form-control mg_b5" name="is_closed">
                        <option value="3">请选择是否结案</option>
                        <option value="1">已结案</option>
                        <option value="0">未结案</option>
                    </select>

                 <!--    <span class="btn-default" type="button">复查是否合格</span> -->
                    <select class="input-xlarge form-control mg_b5" name="case_hege">
                        <option value="">请选择是否合格</option>
                         <option value="1">合格</option>
                         <option value="2">不合格</option>
                    </select>

                 <!--    <span class="btn-default" type="button">是否处罚</span> -->
                    <select class="input-xlarge form-control mg_b5" name="is_punish">
                        <option value="3">请选择是否处罚</option>
                        <option value="0">未处罚</option>
                        <option value="1">已处罚</option>
                    </select>


                    <!-- <span class="btn-default" type="button">是否延期整改</span> -->
                    <select class="input-xlarge form-control mg_b5" name="is_delay">
                        <option value="3">请选择是否延期整改</option>
                        <option value="0">未申请</option>
                        <option value="1">已申请</option>
                    </select>



                    <button class="btn btn-primary mg_b5" type="submit"><i class="fa fa-search"></i>搜索</button>
                </form>






                <div class="form-all">
                    @if($get == 1)
                    <table class="table table-form table-striped table-bordered table-condensed">
                        <thead>
                        <tr>
                            <th width="80">序号</th>
                            <th>案件名称</th>
                            <th>限期整改状态</th>
                            <th>是否申请延期</th>
                            <th>是否受理</th>
                            <th>是否申请复查</th>
                            <th>复查状态</th>
                            <th>案件状态</th>
                              
                                <th align="center">操作</th>
                               
                        </tr>
                        </thead>


                      
                        <tbody>
                             @foreach ($re as $key=>$v)
                            <tr>
                                  <td>{{ $key+1 }}</td>
                                     <td>{{ $v->case_name }}</td>

                                     @if ($v->is_deadline === 0  && $v->is_deadlineok === 0)

                                     <td><a href="{{url('admin/case/no',$v->case_id)}}"  style="color:red;" target="_blank">申请限期整改</a> </td>
                                    @elseif ( $v->is_deadline === 0 && $v->is_deadlineok === 2)
                                    <td><a href="{{url('admin/case/no',$v->case_id)}}"  style="color:red;" target="_blank">审核未通过,请重新申请限期整改</a> </td>

                                     @elseif ( $v->is_deadline === 1 && $v->is_deadlineok === 0)
                                     <td style="color:red;">等待审核</td>

                                     @elseif ( $v->is_deadline === 1 && $v->is_deadlineok === 1)
                                         <td style="color:red;">审核通过,等待领导审批</td>
                                     @elseif ( $v->is_deadline === 1 && $v->is_deadlineok === 3)
                                        <td style="color:green;">领导审批已通过</td>

                                     @endif


                                      @if ($v->is_delay === 1  && $v->is_delayok === 0)
                                      <td style="color:red;">已申请,等待审核</td>
                                      @elseif ($v->is_delay === 0 && $v->is_delayok === 2 )
                                      <td style="color:red;">申请已被拒绝,请重新提交</td>
                                      @elseif ($v->is_delay === 1 && $v->is_delayok === 1 )
                                      <td style="color:red;">审核已通过,等待领导审批</td>
                                      @elseif ($v->is_delay === 1 && $v->is_delayok === 1 )
                                      <td style="color:red;">未申请</td>
                                      @elseif ($v->is_delay === 0 )
                                      <td style="color:red;">未申请</td>
                                      @elseif ($v->is_delay === 1 && $v->is_delayok === 3 )
                                      <td style="color:green;">领导审批已通过</td>
                                      @endif




                                     @if ($v->is_ok === 1)
                                     <td style="color:green;">已受理</td>
                                     @else
                                     <td style="color:red;">未受理</td>
                                     @endif

                                     @if ($v->is_review === 1)
                                     <td style="color:green;">已申请</td>
                                     @else
                                     <td style="color:red;">未申请</td>
                                     @endif
                                    



                                    @if ($v->is_review === 1 && $v->is_reviewok === 0)
                                     <td style="color:red;">已申请,等待审核</td>

                                     @elseif($v->is_review === 0 && $v->is_reviewok === 2)
                                     <td style="color:red;">审核不通过,请重新申请</td>

                                     @elseif($v->is_review === 1 && $v->is_reviewok === 1 && $v->case_hege === 0 && $v->case_hegeok === 0 )
                                     <td style="color:red;">申请审核通过,检查是否合格</td>

                                     @elseif($v->is_review === 1 && $v->is_reviewok === 1 && $v->case_hege === 1 && $v->case_hegeok === 0)

                                     <td style="color:red;">整改合格,等待领导审批</td>

                                     @elseif($v->is_review === 1 && $v->is_reviewok === 1 && $v->case_hege === 0 && $v->case_hegeok === 2)

                                     <td style="color:red;">审批不通过,请重新提交</td>

                                     @elseif($v->is_review === 1 && $v->is_reviewok === 1 && $v->case_hege === 2 && $v->case_hegeok === 0)

                                     <td style="color:red;">整改不合格,等待领导审批</td>

                                     @elseif($v->is_review === 1 && $v->is_reviewok === 1 && $v->case_hege === 2 && $v->case_hegeok === 1 && $v->is_punish === 0)

                                     <td style="color:red;">整改不合格,审批通过,请上传相关文书</td>

                                     @elseif($v->is_punish === 1 && $v->is_closed === 0)

                                     <td style="color:red;">处罚文件已上传,等待领导审批</td>


                                      @elseif($v->is_review === 1 && $v->is_reviewok === 1 && $v->case_hege === 1 && $v->case_hegeok === 1 && $v->is_closed === 1)

                                      <td style="color:green;">整改合格,案件完结</td>

                                      @elseif($v->is_review === 1 && $v->is_reviewok === 1 && $v->case_hege === 2 && $v->case_hegeok === 1 && $v->is_closed === 1)

                                      <td style="color:green;">整改不合格,案件完结</td>





                                     @else
                                     <td style="color:red;">未申请</td>
                                     @endif









                                    @if ($v->is_closed === 1)
                                    <td style="color:green;">已结案</td>
                                    @else
                                    <td style="color:red;">未结案</td>
                                    @endif




                                     <td align="center">

                                        <div role="presentation" class="dropdown">
                                            <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
                                                操作<span class="caret"></span>
                                            </button>
                                            <ul class="dropdown-menu">
                                                <li><a href="{{url('admin/case/edit',$v->case_id)}}">查看处理</a></li>

                                                <li> @if ($v->is_punish === 1)
                                                <a href="{{url('admin/case/cfxq',$v->case_id)}}">查看处罚</a>
                                                @endif</li>

                                                <li><a href="{{url('admin/case/liu',$v->case_id)}}">查看流程图</a></li>

                                                 <li> @if($v->is_deadline === 1 && $v->is_deadlineok === 3)
                                            <a href="{{url('admin/case/zgck',$v->case_id)}}" >整改通知书(警方)</a>
                                           @endif</li>

                                                <li>@if($v->is_deadline === 1)
                                                <a href="{{url('admin/case/qzgck',$v->case_id)}}">整改通知书(企业)</a>
                                               @endif</li>

                                               <li> @if ($v->is_deadlineok === 3 && $v->is_delay === 0 && $v->is_closed === 0 && $v->case_hege === 0)
                                               <a href="{{url('admin/case/upno',$v->case_id)}}">申请整改延期</a>
                                               @elseif ($v->is_delay === 1 && $v->is_delayok !== 3)
                                               <a href="{{url('admin/case/upno',$v->case_id)}}" target="_blank">查看延期申请</a>
                                               @endif</li>

                                               <li>  @if($v->is_deadline === 1 && $v->is_deadlineok === 3)
                                                 <a href="{{url('admin/case/fcedit',$v->case_id)}}" >查看复查</a>
                                                @endif</li>

                                                <li> @if($v->is_delay === 1 && $v->is_delayok === 3)
                                                 <a href="{{url('admin/case/upno',$v->case_id)}}">延期通知书</a>
                                                @endif</li>

                                                <li> <a href="{{url('admin/case/del',$v->case_id)}}" >删除</a></li>
                                               
                                            </ul>
                                        </div>

    <!-- 
                                     <a href="{{url('admin/case/edit',$v->case_id)}}"  class="label label-success tag">查看处理</a>
                                     
       
                                       @if ($v->is_punish === 1)
                                       <a href="{{url('admin/case/cfxq',$v->case_id)}}"  class="label label-success tag">查看处罚</a>

                                       @endif

                                       <a href="{{url('admin/case/liu',$v->case_id)}}"  class="label label-success tag" >查看流程图</a>

                                        
                                      @if($v->is_deadline === 1 && $v->is_deadlineok === 3)
                                        <a href="{{url('admin/case/zgck',$v->case_id)}}"  class="label label-success tag" >整改通知书(警方)</a>
                                       @endif

                                      @if($v->is_deadline === 1)
                                        <a href="{{url('admin/case/qzgck',$v->case_id)}}"  class="label label-success tag" >整改通知书(企业)</a>
                                       @endif







                                       @if ($v->is_deadlineok === 3 && $v->is_delay === 0 && $v->is_closed === 0 && $v->case_hege === 0)
                                       <a href="{{url('admin/case/upno',$v->case_id)}}"  class="label label-warning tag">申请整改延期</a>
                                       @elseif ($v->is_delay === 1 && $v->is_delayok !== 3)
                                       <a href="{{url('admin/case/upno',$v->case_id)}}"  class="label label-warning tag" target="_blank">查看延期申请</a>
                                       @endif



                                      @if($v->is_deadline === 1 && $v->is_deadlineok === 3)
                                       <a href="{{url('admin/case/fcedit',$v->case_id)}}"  class="label label-success tag" >查看复查</a>
                                      @endif


                                      @if($v->is_delay === 1 && $v->is_delayok === 3)
                                       <a href="{{url('admin/case/upno',$v->case_id)}}"  class="label label-warning tag" target="_blank">延期通知书</a>
                                      @endif

  


                                       <a href="{{url('admin/case/del',$v->case_id)}}"  class="label label-warning tag del" style="background-color:red;">删除</a> -->



                                     </td>
                            </tr>
                            @endforeach
                        </tbody>
                    </table>
                </div>

                <span>共{{$count}}条数据</span>
                <ul class="pagination pull-right"></ul>
                
                @else

                  <table class="table table-form table-striped table-bordered table-condensed">
                        <thead>
                        <tr>
                            <th width="80">序号</th>
                            <th>案件名称</th>
                            <th>限期整改状态</th>
                            <th>是否申请延期</th>
                            <th>是否受理</th>
                            <th>是否申请复查</th>
                            <th>复查状态</th>
                            <th>案件状态</th>
                              
                                <th align="center">操作</th>
                               
                        </tr>
                        </thead>
                   </table>



                @endif

            </div>
        </div>
    </div>

    <script type="text/javascript">
        function load_city_data_from_menu($id){
            $('#dg').datagrid('load',{
                city: $id,
            });
            $("input[name='city']").val($id);
            $("input[name='area']").val('');
            $("input[name='org_id']").val('');
        }

        function load_area_data_from_menu($id){
            $('#dg').datagrid('load',{
                area: $id,
            });
            $("input[name='city']").val('');
            $("input[name='area']").val($id);
            $("input[name='org_id']").val('');
        }
        function load_org_data_from_menu($id){
            $('#dg').datagrid('load',{
                org_id: $id,
            });
            $("input[name='city']").val('');
            $("input[name='area']").val('');
            $("input[name='org_id']").val($id);
        }
    </script>
@stop

